import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/home/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/user/info',
    method: 'post'
  })
}

export function delUser(user_id) {
  return request({
    url: '/user/del',
    method: 'post',
    params: {
      user_id: user_id
    }
  })
}

// update User
export function updateUser(user) {
  return request({
    url: '/user/update',
    method: 'post',
    params: {
      account: user.account,
      password: user.password,
      introduction: user.introduction
    }
  })
}

// update User
export function updateStatus(user) {
  return request({
    url: '/user/update',
    method: 'post',
    params: {
      account: user.account,
      status: user.status
    }
  })
}

// create User
export function createUser(user) {
  return request({
    url: '/user/create',
    method: 'post',
    params: {
      account: user.account,
      password: user.password,
      introduction: user.introduction
    }
  })
}

export function getMenuList() {
  return request({
    url: '/auth/rights',
    method: 'post'
  })
}

export function getUserList(params) {
  return request({
    url: '/user/list',
    method: 'post',
    params: {
      page: params.page,
      limit: params.limit
    }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
